<!DOCTYPE html>
<html style="overflow-x: hidden;">
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="icon" href="/image/favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="css/loginHistory.css">
</head>
<body>
<div id="all">
    <div id="herder">
        <span id="tittle">登陆历史</span>
        <p id="tips"><span>以下为您最近20次登录记录，若存在异常情况，请在核实后尽快</span>&nbsp;&nbsp;<a href="http://localhost/upPassword.html" id="button">修改密码</a></p>
    </div>
    <div id="login_history">
        <ul id="login_history_herder">
            <li><span>时间</span></li><li><span>IP</span></li><li><span>浏览器</span></li><li><span>设备</span></li>
        </ul>
        <div id="login_info">
            <!--<ul class="login_info">-->
                <!--<li><span class="login_info_0">01月16日</span></li><li><span class="login_info_1">113.240.*.*</span></li><li><span class="login_info_2">Chrome 70.0</span></li><li><span class="login_info_3">电脑</span></li>-->
            <!--</ul>-->
        </div>
    </div>
</div>
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/2.2.2/jquery.js"></script>
<script src="js/util.js"></script>
<script>
    window.onload=function(){
        var userId = getCookie('userId');
        $.ajax({
            url:'/pan/findUserHistory',
            type:'post',
            data:{userId:userId},
            success:function (e) {
               if( e.message=="查询成功"){
                   var content = '';
                   for(var x in e.data){
                       var time = e.data[x].loginTime;
                       var loginTime = getTime(time);
                       content+=`<ul class="login_info"><li><span>${loginTime}</span></li><li><span>${e.data[x].loginIp}</span></li><li><span>${e.data[x].loginBrowser}</span></li><li><span>${e.data[x].loginDevice}</span></li></ul>`;
                   }
                   $("#login_info").html(content);
                }
            }
        });
    }
</script>
</body>
</html>